﻿package view.components.footer 
{
	import flash.events.MouseEvent;
	import flash.display.MovieClip;
	
	import org.casalib.util.NavigateUtil;
	
	import gs.TweenLite;
	import gs.easing.Circ;
	
	/**
	 * ...
	 * @author Lobanov
	 */
	public class VkBut extends MovieClip
	{
		public var linkArea:MovieClip;
		public var vkMask:MovieClip;
		
		public function VkBut($xmlData:XMLList) 
		{			
			linkArea.alpha = 0;
			linkArea.buttonMode = true;
			
			linkArea.addEventListener(MouseEvent.CLICK, clickHandle);
			linkArea.addEventListener(MouseEvent.ROLL_OVER, overHandle);
			linkArea.addEventListener(MouseEvent.ROLL_OUT, outHandle);
			
			/**
			 * EVENTS
			 */
			function overHandle(e:MouseEvent):void {
				TweenLite.to(vkMask, 1.5, { x:-2, ease:Circ.easeOut } );
			}
			
			function outHandle(e:MouseEvent):void {
				TweenLite.to(vkMask, 1.5, { x:-81.8, ease:Circ.easeOut} );
			}
			
			function clickHandle(e:MouseEvent):void {
				var s:String = $xmlData.vkontakte.@link;
				NavigateUtil.openUrl(s, NavigateUtil.WINDOW_SELF);
			}
			
		}
		
	}

}